//package com.power.sifa.filter;
//
//import org.springframework.cloud.openfeign.FeignContext;
//import org.springframework.cloud.openfeign.FeignLoggerFactory;
//import org.springframework.cloud.openfeign.support.SpringMvcContract;
//import org.springframework.stereotype.Component;
//import org.springframework.web.filter.OncePerRequestFilter;
//
//import javax.servlet.FilterChain;
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
////@Component
//public class FeignRequestFilter extends OncePerRequestFilter {
//
//    private final FeignContext feignContext;
//    private final SpringMvcContract contract;
//    private final FeignLoggerFactory loggerFactory;
//
//    public FeignRequestFilter(FeignContext feignContext, SpringMvcContract contract, FeignLoggerFactory loggerFactory) {
//        this.feignContext = feignContext;
//        this.contract = contract;
//        this.loggerFactory = loggerFactory;
//    }
//
//    @Override
//    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
//            throws ServletException, IOException {
//
//        if (isFeignRequest(request)) {
//            // 过滤Feign请求的逻辑
//            // ...
//            response.setStatus(HttpServletResponse.SC_FORBIDDEN); // 返回403禁止访问的状态码示例
//            return;
//        } else {
//            // 处理其他请求的逻辑
//            // ...
//        }
//
//        filterChain.doFilter(request, response);
//    }
//
//    private boolean isFeignRequest(HttpServletRequest request) {
//        // 判断请求是否来自Feign
//        return request.getHeader("feign") != null;
//    }
//}